package com.PAT.UnSatisfying;

import java.util.HashSet;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: zjz
 * @Date: 2021/11/30/20:01
 * @Description:
 * @Target:
 */
public class 旧键盘打字 {
    // 第一波输入的塞入set,然后第二波数据走的时候对比set有没.

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s1 = in.next();
        HashSet set = GetSetByIn(s1);
        String ss = in.next();
        for (int i = 0; i <ss.length(); i++) {
            if (set.contains(-1)&&(ss.charAt(i)>='A'&&ss.charAt(i)<='Z')){

            }else if (set.contains(ss.charAt(i))){

            }else {
                System.out.print(ss.charAt(i));
            }
        }
    }

    // 编写一个方法,判断怎么塞.
    public static HashSet GetSetByIn(String ss){
        HashSet set = new HashSet();

        for (int i = 0; i <= ss.length()-1; i++) {
            if (ss.charAt(i)==','||ss.charAt(i)=='.'||ss.charAt(i)=='-'||ss.charAt(i)=='+'){
                set.add(-1);
                set.add('.');
                set.add(',');
                set.add('-');
                set.add('+');
            }else if (ss.charAt(i)>='A'&&ss.charAt(i)<='Z'){
                set.add(ss.charAt(i));
                set.add(Character.toLowerCase(ss.charAt(i)));
            }else if (ss.charAt(i)=='_'){

            }else {
                set.add(ss.charAt(i));
            }
        }


        return set;
    }

}
